package com.ybkj.o2o.zhuanche.thrift;

import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Generated;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-12-05")
public class ThriftService {

  public interface Iface {

    public IdResult nextId(long workerId) throws org.apache.thrift.TException;

    public IdsResult nextIds(long workerId, long num) throws org.apache.thrift.TException;

    public long datacenterId() throws org.apache.thrift.TException;

    public long timestamp() throws org.apache.thrift.TException;

    public int ping() throws org.apache.thrift.TException;

  }

  public interface AsyncIface {

    public void nextId(long workerId, org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException;

    public void nextIds(long workerId, long num,
        org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException;

    public void datacenterId(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException;

    public void timestamp(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException;

    public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException;

  }

  public static class Client extends org.apache.thrift.TServiceClient implements Iface {
    public static class Factory implements org.apache.thrift.TServiceClientFactory<Client> {
      public Factory() {}

      public Client getClient(org.apache.thrift.protocol.TProtocol prot) {
        return new Client(prot);
      }

      public Client getClient(org.apache.thrift.protocol.TProtocol iprot,
          org.apache.thrift.protocol.TProtocol oprot) {
        return new Client(iprot, oprot);
      }
    }

    public Client(org.apache.thrift.protocol.TProtocol prot) {
      super(prot, prot);
    }

    public Client(org.apache.thrift.protocol.TProtocol iprot,
        org.apache.thrift.protocol.TProtocol oprot) {
      super(iprot, oprot);
    }

    public IdResult nextId(long workerId) throws org.apache.thrift.TException {
      send_nextId(workerId);
      return recv_nextId();
    }

    /**
     * 发送下一个id.
     */
    public void send_nextId(long workerId) throws org.apache.thrift.TException {
      NextIdArgs args = new NextIdArgs();
      args.setWorkerId(workerId);
      sendBase("nextId", args);
    }

    /**
     * 打印下一个id.
     */
    public IdResult recv_nextId() throws org.apache.thrift.TException {
      NextIdResult result = new NextIdResult();
      receiveBase(result, "nextId");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT, "nextId failed: unknown result");
    }

    public IdsResult nextIds(long workerId, long num) throws org.apache.thrift.TException {
      send_nextIds(workerId, num);
      return recv_nextIds();
    }

    /**
     * 设置下一个id.
     */
    public void send_nextIds(long workerId, long num) throws org.apache.thrift.TException {
      NextIdsArgs args = new NextIdsArgs();
      args.setWorkerId(workerId);
      args.setNum(num);
      sendBase("nextIds", args);
    }

    /**
     * 打印下一个id.
     */
    public IdsResult recv_nextIds() throws org.apache.thrift.TException {
      NextIdsResult result = new NextIdsResult();
      receiveBase(result, "nextIds");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT, "nextIds failed: unknown result");
    }

    public long datacenterId() throws org.apache.thrift.TException {
      send_datacenterId();
      return recv_datacenterId();
    }

    public void send_datacenterId() throws org.apache.thrift.TException {
      DatacenterIdArgs args = new DatacenterIdArgs();
      sendBase("datacenterId", args);
    }

    /**
     * 打印id.
     */
    public long recv_datacenterId() throws org.apache.thrift.TException {
      DatacenterIdResult result = new DatacenterIdResult();
      receiveBase(result, "datacenterId");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT,
          "datacenterId failed: unknown result");
    }

    public long timestamp() throws org.apache.thrift.TException {
      send_timestamp();
      return recv_timestamp();
    }

    public void send_timestamp() throws org.apache.thrift.TException {
      TimestampArgs args = new TimestampArgs();
      sendBase("timestamp", args);
    }

    /**
     * 打印时间戳.
     */
    public long recv_timestamp() throws org.apache.thrift.TException {
      TimestampResult result = new TimestampResult();
      receiveBase(result, "timestamp");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT,
          "timestamp failed: unknown result");
    }

    public int ping() throws org.apache.thrift.TException {
      send_ping();
      return recv_ping();
    }

    public void send_ping() throws org.apache.thrift.TException {
      PingArgs args = new PingArgs();
      sendBase("ping", args);
    }

    /**
     * 打印拼.
     */
    public int recv_ping() throws org.apache.thrift.TException {
      PingResult result = new PingResult();
      receiveBase(result, "ping");
      if (result.isSetSuccess()) {
        return result.success;
      }
      throw new org.apache.thrift.TApplicationException(
          org.apache.thrift.TApplicationException.MISSING_RESULT, "ping failed: unknown result");
    }

  }
  
  public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements
      AsyncIface {
    
    public static class Factory implements 
        org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
      private org.apache.thrift.async.TAsyncClientManager clientManager;
      private org.apache.thrift.protocol.TProtocolFactory protocolFactory;

      public Factory(org.apache.thrift.async.TAsyncClientManager clientManager,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory) {
        this.clientManager = clientManager;
        this.protocolFactory = protocolFactory;
      }

      public AsyncClient getAsyncClient(
          org.apache.thrift.transport.TNonblockingTransport transport) {
        return new AsyncClient(protocolFactory, clientManager, transport);
      }
    }

    public AsyncClient(org.apache.thrift.protocol.TProtocolFactory protocolFactory,
        org.apache.thrift.async.TAsyncClientManager clientManager,
        org.apache.thrift.transport.TNonblockingTransport transport) {
      super(protocolFactory, clientManager, transport);
    }

    /**
     * 下一个id.
     */
    public void nextId(long workerId, org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      NextIdCall methodCall =
          new NextIdCall(workerId, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = methodCall;
      ___manager.call(methodCall);
    }

    public static class NextIdCall extends org.apache.thrift.async.TAsyncMethodCall {
      private long workerId;

      public NextIdCall(long workerId, org.apache.thrift.async.AsyncMethodCallback resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.workerId = workerId;
      }

      /**
       * 写入参数.
       */
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("nextId",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        NextIdArgs args = new NextIdArgs();
        args.setWorkerId(workerId);
        args.write(prot);
        prot.writeMessageEnd();
      }

      /**
       * 获取结果集.
       */
      public IdResult getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_nextId();
      }
    }

    /**
     * 下一个id集合.
     */
    public void nextIds(long workerId, long num,
        org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      NextIdsCall methodCall =
          new NextIdsCall(workerId, num, resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = methodCall;
      ___manager.call(methodCall);
    }

    public static class NextIdsCall extends org.apache.thrift.async.TAsyncMethodCall {
      private long workerId;
      private long num;

      /**
       * 下一个id集合.
       */
      public NextIdsCall(long workerId, long num,
          org.apache.thrift.async.AsyncMethodCallback resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
        this.workerId = workerId;
        this.num = num;
      }

      /**
       * 写入参数.
       */
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("nextIds",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        NextIdsArgs args = new NextIdsArgs();
        args.setWorkerId(workerId);
        args.setNum(num);
        args.write(prot);
        prot.writeMessageEnd();
      }

      /**
       * 获取结果集.
       */
      public IdsResult getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_nextIds();
      }
    }

    /**
     * 资料处理中心.
     */
    public void datacenterId(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      DatacenterIdCall methodCall =
          new DatacenterIdCall(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = methodCall;
      ___manager.call(methodCall);
    }

    public static class DatacenterIdCall extends org.apache.thrift.async.TAsyncMethodCall {
      public DatacenterIdCall(org.apache.thrift.async.AsyncMethodCallback resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      /**
       * 写入参数.
       */
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("datacenterId",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        DatacenterIdArgs args = new DatacenterIdArgs();
        args.write(prot);
        prot.writeMessageEnd();
      }

      /**
       * 获取结果集.
       */
      public long getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_datacenterId();
      }
    }

    /**
     * 时间戳.
     */
    public void timestamp(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      TimestampCall methodCall =
          new TimestampCall(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = methodCall;
      ___manager.call(methodCall);
    }

    public static class TimestampCall extends org.apache.thrift.async.TAsyncMethodCall {
      public TimestampCall(org.apache.thrift.async.AsyncMethodCallback resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      /**
       * 写入参数.
       */
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("timestamp",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        TimestampArgs args = new TimestampArgs();
        args.write(prot);
        prot.writeMessageEnd();
      }

      /**
       * 获取结果集.
       */
      public long getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_timestamp();
      }
    }

    /**
     * 拼.
     */
    public void ping(org.apache.thrift.async.AsyncMethodCallback resultHandler)
        throws org.apache.thrift.TException {
      checkReady();
      PingCall methodCall = new PingCall(resultHandler, this, ___protocolFactory, ___transport);
      this.___currentMethod = methodCall;
      ___manager.call(methodCall);
    }

    public static class PingCall extends org.apache.thrift.async.TAsyncMethodCall {
      public PingCall(org.apache.thrift.async.AsyncMethodCallback resultHandler,
          org.apache.thrift.async.TAsyncClient client,
          org.apache.thrift.protocol.TProtocolFactory protocolFactory,
          org.apache.thrift.transport.TNonblockingTransport transport)
          throws org.apache.thrift.TException {
        super(client, protocolFactory, transport, resultHandler, false);
      }

      /**
       * 写入参数.
       */
      public void write_args(org.apache.thrift.protocol.TProtocol prot)
          throws org.apache.thrift.TException {
        prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("ping",
            org.apache.thrift.protocol.TMessageType.CALL, 0));
        PingArgs args = new PingArgs();
        args.write(prot);
        prot.writeMessageEnd();
      }

      /**
       * 获取结果集.
       */
      public int getResult() throws org.apache.thrift.TException {
        if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
          throw new IllegalStateException("Method call not finished!");
        }
        org.apache.thrift.transport.TMemoryInputTransport memoryTransport =
            new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
        org.apache.thrift.protocol.TProtocol prot =
            client.getProtocolFactory().getProtocol(memoryTransport);
        return (new Client(prot)).recv_ping();
      }
    }

  }

  public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I>
      implements org.apache.thrift.TProcessor {

    /**
     * 处理器.
     */
    public Processor(I iface) {
      super(iface,getProcessMap(
          new HashMap<String, org.apache.thrift.ProcessFunction
          <I, ? extends org.apache.thrift.TBase>>()));
    }

    protected Processor(
        I iface,Map<String, org.apache.thrift.ProcessFunction
        <I, ? extends org.apache.thrift.TBase>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends Iface> Map<String, org.apache.thrift.ProcessFunction
        <I, ? extends org.apache.thrift.TBase>> getProcessMap(
        Map<String, org.apache.thrift.ProcessFunction
        <I, ? extends org.apache.thrift.TBase>> processMap) {
      processMap.put("nextId", new NextId());
      processMap.put("nextIds", new NextIds());
      processMap.put("datacenterId", new DatacenterId());
      processMap.put("timestamp", new Timestamp());
      processMap.put("ping", new Ping());
      return processMap;
    }

    public static class NextId<I extends Iface> extends
        org.apache.thrift.ProcessFunction<I, NextIdArgs> {
      public NextId() {
        super("nextId");
      }

      public NextIdArgs getEmptyArgsInstance() {
        return new NextIdArgs();
      }

      protected boolean isOneway() {
        return false;
      }

      /**
       * 获取结果集.
       */
      public NextIdResult getResult(I iface, NextIdArgs args) throws org.apache.thrift.TException {
        NextIdResult result = new NextIdResult();
        result.success = iface.nextId(args.workerId);
        return result;
      }
    }

    public static class NextIds<I extends Iface> extends
        org.apache.thrift.ProcessFunction<I, NextIdsArgs> {
      public NextIds() {
        super("nextIds");
      }

      public NextIdsArgs getEmptyArgsInstance() {
        return new NextIdsArgs();
      }

      protected boolean isOneway() {
        return false;
      }

      /**
       * 获取结果集.
       */
      public NextIdsResult getResult(I iface, NextIdsArgs args)
          throws org.apache.thrift.TException {
        NextIdsResult result = new NextIdsResult();
        result.success = iface.nextIds(args.workerId, args.num);
        return result;
      }
    }

    public static class DatacenterId<I extends Iface> extends
        org.apache.thrift.ProcessFunction<I, DatacenterIdArgs> {
      public DatacenterId() {
        super("datacenterId");
      }

      public DatacenterIdArgs getEmptyArgsInstance() {
        return new DatacenterIdArgs();
      }

      protected boolean isOneway() {
        return false;
      }

      /**
       * 获取结果集.
       */
      public DatacenterIdResult getResult(I iface, DatacenterIdArgs args)
          throws org.apache.thrift.TException {
        DatacenterIdResult result = new DatacenterIdResult();
        result.success = iface.datacenterId();
        result.setSuccessIsSet(true);
        return result;
      }
    }

    public static class Timestamp<I extends Iface> extends
        org.apache.thrift.ProcessFunction<I, TimestampArgs> {
      public Timestamp() {
        super("timestamp");
      }

      public TimestampArgs getEmptyArgsInstance() {
        return new TimestampArgs();
      }

      protected boolean isOneway() {
        return false;
      }

      /**
       * 获取结果集.
       */
      public TimestampResult getResult(I iface, TimestampArgs args)
          throws org.apache.thrift.TException {
        TimestampResult result = new TimestampResult();
        result.success = iface.timestamp();
        result.setSuccessIsSet(true);
        return result;
      }
    }

    public static class Ping<I extends Iface> extends
        org.apache.thrift.ProcessFunction<I, PingArgs> {
      public Ping() {
        super("ping");
      }

      public PingArgs getEmptyArgsInstance() {
        return new PingArgs();
      }

      protected boolean isOneway() {
        return false;
      }

      /**
       * 获取结果集.
       */
      public PingResult getResult(I iface, PingArgs args) throws org.apache.thrift.TException {
        PingResult result = new PingResult();
        result.success = iface.ping();
        result.setSuccessIsSet(true);
        return result;
      }
    }

  }

  public static class AsyncProcessor<I extends AsyncIface> extends
      org.apache.thrift.TBaseAsyncProcessor<I> {
    private static final Logger LOGGER = LoggerFactory.getLogger(AsyncProcessor.class.getName());

    /**
     * 异步.
     */
    public AsyncProcessor(I iface) {
      super(iface,getProcessMap(
          new HashMap<String, org.apache.thrift.AsyncProcessFunction
          <I, ? extends org.apache.thrift.TBase, ?>>()));
    }

    protected AsyncProcessor(
        I iface,
        Map<String, org.apache.thrift.AsyncProcessFunction
        <I, ? extends org.apache.thrift.TBase, ?>> processMap) {
      super(iface, getProcessMap(processMap));
    }

    private static <I extends AsyncIface> 
        Map<String, org.apache.thrift.AsyncProcessFunction
        <I, ? extends org.apache.thrift.TBase, ?>> 
          getProcessMap(Map<String, org.apache.thrift.AsyncProcessFunction
          <I, ? extends org.apache.thrift.TBase, ?>> processMap) {
      processMap.put("nextId", new NextId());
      processMap.put("nextIds", new NextIds());
      processMap.put("datacenterId", new DatacenterId());
      processMap.put("timestamp", new Timestamp());
      processMap.put("ping", new Ping());
      return processMap;
    }

    public static class NextId<I extends AsyncIface> extends
        org.apache.thrift.AsyncProcessFunction<I, NextIdArgs, IdResult> {
      public NextId() {
        super("nextId");
      }

      public NextIdArgs getEmptyArgsInstance() {
        return new NextIdArgs();
      }

      /**
       * 获取结果集.
       */
      public AsyncMethodCallback<IdResult> getResultHandler(final AsyncFrameBuffer fb,
          final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<IdResult>() {
          public void onComplete(IdResult obj) {
            NextIdResult result = new NextIdResult();
            result.success = obj;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }

          public void onError(Exception ex) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg =
                  (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(
                      org.apache.thrift.TApplicationException.INTERNAL_ERROR, ex.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
              return;
            } catch (Exception exx) {
              LOGGER.error("Exception writing to internal frame buffer", exx);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, NextIdArgs args,
          org.apache.thrift.async.AsyncMethodCallback<IdResult> resultHandler) throws TException {
        iface.nextId(args.workerId, resultHandler);
      }
    }

    public static class NextIds<I extends AsyncIface> extends
        org.apache.thrift.AsyncProcessFunction<I, NextIdsArgs, IdsResult> {
      public NextIds() {
        super("nextIds");
      }

      public NextIdsArgs getEmptyArgsInstance() {
        return new NextIdsArgs();
      }

      /**
       * 获取结果集.
       */
      public AsyncMethodCallback<IdsResult> getResultHandler(final AsyncFrameBuffer fb,
          final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<IdsResult>() {
          public void onComplete(IdsResult obj) {
            NextIdsResult result = new NextIdsResult();
            result.success = obj;
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }

          public void onError(Exception ex) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg =
                  (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(
                      org.apache.thrift.TApplicationException.INTERNAL_ERROR, ex.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
              return;
            } catch (Exception exc) {
              LOGGER.error("Exception writing to internal frame buffer", exc);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, NextIdsArgs args,
          org.apache.thrift.async.AsyncMethodCallback<IdsResult> resultHandler) throws TException {
        iface.nextIds(args.workerId, args.num, resultHandler);
      }
    }

    public static class DatacenterId<I extends AsyncIface> extends
        org.apache.thrift.AsyncProcessFunction<I, DatacenterIdArgs, Long> {
      public DatacenterId() {
        super("datacenterId");
      }

      public DatacenterIdArgs getEmptyArgsInstance() {
        return new DatacenterIdArgs();
      }

      /**
       * 获取结果集.
       */
      public AsyncMethodCallback<Long> getResultHandler(
          final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Long>() {
          public void onComplete(Long lo) {
            DatacenterIdResult result = new DatacenterIdResult();
            result.success = lo;
            result.setSuccessIsSet(true);
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }

          public void onError(Exception ex) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg =
                  (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(
                      org.apache.thrift.TApplicationException.INTERNAL_ERROR, ex.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
              return;
            } catch (Exception exx) {
              LOGGER.error("Exception writing to internal frame buffer", exx);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, DatacenterIdArgs args,
          org.apache.thrift.async.AsyncMethodCallback<Long> resultHandler) throws TException {
        iface.datacenterId(resultHandler);
      }
    }

    public static class Timestamp<I extends AsyncIface> extends
        org.apache.thrift.AsyncProcessFunction<I, TimestampArgs, Long> {
      public Timestamp() {
        super("timestamp");
      }

      public TimestampArgs getEmptyArgsInstance() {
        return new TimestampArgs();
      }

      /**
       * 获取结果集头信息.
       */
      public AsyncMethodCallback<Long> getResultHandler(
          final AsyncFrameBuffer fb, final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Long>() {
          public void onComplete(Long obj) {
            TimestampResult result = new TimestampResult();
            result.success = obj;
            result.setSuccessIsSet(true);
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }

          public void onError(Exception ex) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg =
                  (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(
                      org.apache.thrift.TApplicationException.INTERNAL_ERROR, ex.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
              return;
            } catch (Exception exx) {
              LOGGER.error("Exception writing to internal frame buffer", exx);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, TimestampArgs args,
          org.apache.thrift.async.AsyncMethodCallback<Long> resultHandler) throws TException {
        iface.timestamp(resultHandler);
      }
    }

    public static class Ping<I extends AsyncIface> extends
        org.apache.thrift.AsyncProcessFunction<I, PingArgs, Integer> {
      public Ping() {
        super("ping");
      }

      public PingArgs getEmptyArgsInstance() {
        return new PingArgs();
      }

      /**
       * 获取结果集.
       */
      public AsyncMethodCallback<Integer> getResultHandler(final AsyncFrameBuffer fb,
          final int seqid) {
        final org.apache.thrift.AsyncProcessFunction fcall = this;
        return new AsyncMethodCallback<Integer>() {
          public void onComplete(Integer obj) {
            PingResult result = new PingResult();
            result.success = obj;
            result.setSuccessIsSet(true);
            try {
              fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY, seqid);
              return;
            } catch (Exception ex) {
              LOGGER.error("Exception writing to internal frame buffer", ex);
            }
            fb.close();
          }

          public void onError(Exception ex) {
            byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
            org.apache.thrift.TBase msg;
            {
              msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
              msg =
                  (org.apache.thrift.TBase) new org.apache.thrift.TApplicationException(
                      org.apache.thrift.TApplicationException.INTERNAL_ERROR, ex.getMessage());
            }
            try {
              fcall.sendResponse(fb, msg, msgType, seqid);
              return;
            } catch (Exception exx) {
              LOGGER.error("Exception writing to internal frame buffer", exx);
            }
            fb.close();
          }
        };
      }

      protected boolean isOneway() {
        return false;
      }

      public void start(I iface, PingArgs args,
          org.apache.thrift.async.AsyncMethodCallback<Integer> resultHandler) throws TException {
        iface.ping(resultHandler);
      }
    }

  }

  public static class NextIdArgs implements
      org.apache.thrift.TBase<NextIdArgs, NextIdArgs.Fields>, java.io.Serializable, Cloneable,
      Comparable<NextIdArgs> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("nextId_args");

    private static final org.apache.thrift.protocol.TField WORKER_ID_FIELD_DESC =
        new org.apache.thrift.protocol.TField("workerId", org.apache.thrift.protocol.TType.I64,
            (short) 1);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new NextIdArgsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new NextIdArgsTupleSchemeFactory());
    }

    public long workerId; // required

    /**
     * The set of fields this struct contains,
     *  along with convenience methods for finding and manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      WORKER_ID((short) 1, "workerId");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 1: // WORKER_ID
            return WORKER_ID;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    private static final int __WORKERID_ISSET_ID = 0;
    private byte issetBitfield = 0;
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap
          .put(Fields.WORKER_ID, new org.apache.thrift.meta_data.FieldMetaData("workerId",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData
          .addStructMetaDataMap(NextIdArgs.class, metaDataMap);
    }

    public NextIdArgs() {}

    /**
     * 下一个参数.
     */
    public NextIdArgs(long workerId) {
      this();
      this.workerId = workerId;
      setWorkerIdIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public NextIdArgs(NextIdArgs other) {
      issetBitfield = other.issetBitfield;
      this.workerId = other.workerId;
    }

    public NextIdArgs deepCopy() {
      return new NextIdArgs(this);
    }

    @Override
    public void clear() {
      setWorkerIdIsSet(false);
      this.workerId = 0;
    }

    public long getWorkerId() {
      return this.workerId;
    }

    /**
     * 设置工作id.
     */
    public NextIdArgs setWorkerId(long workerId) {
      this.workerId = workerId;
      setWorkerIdIsSet(true);
      return this;
    }

    public void unsetWorkerId() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __WORKERID_ISSET_ID);
    }

    /** Returns true if field workerId is set (has been assigned a value) and false otherwise. */
    public boolean isSetWorkerId() {
      return EncodingUtils.testBit(issetBitfield, __WORKERID_ISSET_ID);
    }

    public void setWorkerIdIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __WORKERID_ISSET_ID, value);
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      
      switch (field) {
        case WORKER_ID:
          if (value == null) {
            unsetWorkerId();
          } else {
            setWorkerId((Long) value);
          }
          break;
        default:

      }
    }

    /**
     * 获取字段值.
     */
    public Object getFieldValue(Fields field) {
      
      switch (field) {
        case WORKER_ID:
          return getWorkerId();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case WORKER_ID:
          return isSetWorkerId();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof NextIdArgs) {
        return this.equals((NextIdArgs) that);
      }
      return false;
    }

    /**
     * 比较值相等.
     */
    public boolean equals(NextIdArgs that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentWorkerId = true;
      boolean thatPresentWorkerId = true;
      if (thisPresentWorkerId || thatPresentWorkerId) {
        if (!(thisPresentWorkerId && thatPresentWorkerId)) {
          return false;
        }
        if (this.workerId != that.workerId) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentWorkerId = true;
      list.add(presentWorkerId);
      if (presentWorkerId) {
        list.add(workerId);
      }
      return list.hashCode();
    }

    @Override
    public int compareTo(NextIdArgs other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetWorkerId()).compareTo(other.isSetWorkerId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetWorkerId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerId, other.workerId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("nextId_args(");

      sb.append("workerId:");
      sb.append(this.workerId);
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        // it doesn't seem like you should have to do this, but java serialization is wacky, and
        // doesn't call the default constructor.
        issetBitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class NextIdArgsStandardSchemeFactory implements SchemeFactory {
      public NextIdArgsStandardScheme getScheme() {
        return new NextIdArgsStandardScheme();
      }
    }

    private static class NextIdArgsStandardScheme extends StandardScheme<NextIdArgs> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, NextIdArgs struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 1: // WORKER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                struct.workerId = iprot.readI64();
                struct.setWorkerIdIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, NextIdArgs struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldBegin(WORKER_ID_FIELD_DESC);
        oprot.writeI64(struct.workerId);
        oprot.writeFieldEnd();
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class NextIdArgsTupleSchemeFactory implements SchemeFactory {
      public NextIdArgsTupleScheme getScheme() {
        return new NextIdArgsTupleScheme();
      }
    }

    private static class NextIdArgsTupleScheme extends TupleScheme<NextIdArgs> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, NextIdArgs struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetWorkerId()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetWorkerId()) {
          oprot.writeI64(struct.workerId);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, NextIdArgs struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.workerId = iprot.readI64();
          struct.setWorkerIdIsSet(true);
        }
      }
    }

  }

  public static class NextIdResult implements
      org.apache.thrift.TBase<NextIdResult, NextIdResult.Fields>, java.io.Serializable,
      Cloneable, Comparable<NextIdResult> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("nextId_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT,
            (short) 0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new NextIdResultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new NextIdResultTupleSchemeFactory());
    }

    public IdResult success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap.put(Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
          org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
              IdResult.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NextIdResult.class,
          metaDataMap);
    }

    public NextIdResult() {}

    public NextIdResult(IdResult success) {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public NextIdResult(NextIdResult other) {
      if (other.isSetSuccess()) {
        this.success = new IdResult(other.success);
      }
    }

    public NextIdResult deepCopy() {
      return new NextIdResult(this);
    }

    @Override
    public void clear() {
      this.success = null;
    }

    public IdResult getSuccess() {
      return this.success;
    }

    public NextIdResult setSuccess(IdResult success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise. */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    /**
     * 设置成功值设置.
     */
    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((IdResult) value);
          }
          break;
          
        default:

      }
    }

    /**
     * 获取字段值.
     */
    public Object getFieldValue(Fields field) {
      switch (field) {
        case SUCCESS:
          return getSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof NextIdResult) {
        return this.equals((NextIdResult) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(NextIdResult that) {
      if (that == null) {
        return false;
      }
      boolean thisPresentSuccess = true && this.isSetSuccess();
      boolean thatPresentSuccess = true && that.isSetSuccess();
      if (thisPresentSuccess || thatPresentSuccess) {
        if (!(thisPresentSuccess && thatPresentSuccess)) {
          return false;
        }
        if (!this.success.equals(that.success)) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentSuccess = true && (isSetSuccess());
      list.add(presentSuccess);
      if (presentSuccess) {
        list.add(success);
      }

      return list.hashCode();
    }

    @Override
    public int compareTo(NextIdResult other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("nextId_result(");

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      sb.append(")");
      return sb.toString();
    }

    /**
     * 验证.
     */
    public void validate() throws org.apache.thrift.TException {
      if (success != null) {
        success.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class NextIdResultStandardSchemeFactory implements SchemeFactory {
      public NextIdResultStandardScheme getScheme() {
        return new NextIdResultStandardScheme();
      }
    }

    private static class NextIdResultStandardScheme extends StandardScheme<NextIdResult> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, NextIdResult struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new IdResult();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, NextIdResult struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class NextIdResultTupleSchemeFactory implements SchemeFactory {
      public NextIdResultTupleScheme getScheme() {
        return new NextIdResultTupleScheme();
      }
    }

    private static class NextIdResultTupleScheme extends TupleScheme<NextIdResult> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, NextIdResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, NextIdResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = new IdResult();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

  public static class NextIdsArgs implements
      org.apache.thrift.TBase<NextIdsArgs, NextIdsArgs.Fields>, java.io.Serializable, Cloneable,
      Comparable<NextIdsArgs> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("nextIds_args");

    private static final org.apache.thrift.protocol.TField WORKER_ID_FIELD_DESC =
        new org.apache.thrift.protocol.TField("workerId", org.apache.thrift.protocol.TType.I64,
            (short) 1);
    private static final org.apache.thrift.protocol.TField NUM_FIELD_DESC =
        new org.apache.thrift.protocol.TField("num", org.apache.thrift.protocol.TType.I64,
            (short) 2);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new NextIdsArgsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new NextIdsArgsTupleSchemeFactory());
    }

    public long workerId; // required
    public long num; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and.
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      WORKER_ID((short) 1, "workerId"), NUM((short) 2, "num");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 1: // WORKER_ID
            return WORKER_ID;
          case 2: // NUM
            return NUM;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    private static final int __WORKERID_ISSET_ID = 0;
    private static final int __NUM_ISSET_ID = 1;
    private byte issetBitfield = 0;
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap
          .put(Fields.WORKER_ID, new org.apache.thrift.meta_data.FieldMetaData("workerId",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I64)));
      tmpMap
          .put(Fields.NUM, new org.apache.thrift.meta_data.FieldMetaData("num",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NextIdsArgs.class,
          metaDataMap);
    }

    public NextIdsArgs() {}

    /**
     * 下一个参数.
     */
    public NextIdsArgs(long workerId, long num) {
      this();
      this.workerId = workerId;
      setWorkerIdIsSet(true);
      this.num = num;
      setNumIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public NextIdsArgs(NextIdsArgs other) {
      issetBitfield = other.issetBitfield;
      this.workerId = other.workerId;
      this.num = other.num;
    }

    public NextIdsArgs deepCopy() {
      return new NextIdsArgs(this);
    }

    @Override
    public void clear() {
      setWorkerIdIsSet(false);
      this.workerId = 0;
      setNumIsSet(false);
      this.num = 0;
    }

    public long getWorkerId() {
      return this.workerId;
    }

    /**
     * 设置工作id.
     */
    public NextIdsArgs setWorkerId(long workerId) {
      this.workerId = workerId;
      setWorkerIdIsSet(true);
      return this;
    }

    public void unsetWorkerId() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __WORKERID_ISSET_ID);
    }

    /** Returns true if field workerId is set (has been assigned a value) and false otherwise. */
    public boolean isSetWorkerId() {
      return EncodingUtils.testBit(issetBitfield, __WORKERID_ISSET_ID);
    }

    public void setWorkerIdIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __WORKERID_ISSET_ID, value);
    }

    public long getNum() {
      return this.num;
    }

    /**
     * 设置数量.
     */
    public NextIdsArgs setNum(long num) {
      this.num = num;
      setNumIsSet(true);
      return this;
    }

    public void unsetNum() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __NUM_ISSET_ID);
    }

    /** Returns true if field num is set (has been assigned a value) and false otherwise. */
    public boolean isSetNum() {
      return EncodingUtils.testBit(issetBitfield, __NUM_ISSET_ID);
    }

    public void setNumIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __NUM_ISSET_ID, value);
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      
      switch (field) {
        case WORKER_ID:
          if (value == null) {
            unsetWorkerId();
          } else {
            setWorkerId((Long) value);
          }
          break;

        case NUM:
          if (value == null) {
            unsetNum();
          } else {
            setNum((Long) value);
          }
          break;
        default:
      }
    }

    /**
     * 获取字段值.
     */
    public Object getFieldValue(Fields field) {
      switch (field) {
        case WORKER_ID:
          return getWorkerId();

        case NUM:
          return getNum();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case WORKER_ID:
          return isSetWorkerId();
        case NUM:
          return isSetNum();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof NextIdsArgs) {
        return this.equals((NextIdsArgs) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(NextIdsArgs that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentWorkerId = true;
      boolean thatPresentWorkerId = true;
      if (thisPresentWorkerId || thatPresentWorkerId) {
        if (!(thisPresentWorkerId && thatPresentWorkerId)) {
          return false;
        }
        if (this.workerId != that.workerId) {
          return false;
        }
      }

      boolean thisPresentNum = true;
      boolean thatPresentNum = true;
      if (thisPresentNum || thatPresentNum) {
        if (!(thisPresentNum && thatPresentNum)) {
          return false;
        }
        if (this.num != that.num) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentWorkerId = true;
      list.add(presentWorkerId);
      if (presentWorkerId) {
        list.add(workerId);
      }

      boolean presentNum = true;
      list.add(presentNum);
      if (presentNum) {
        list.add(num);
      }

      return list.hashCode();
    }

    @Override
    public int compareTo(NextIdsArgs other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetWorkerId()).compareTo(other.isSetWorkerId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetWorkerId()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerId, other.workerId);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      lastComparison = Boolean.valueOf(isSetNum()).compareTo(other.isSetNum());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetNum()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.num, other.num);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("nextIds_args(");
      boolean first = true;

      sb.append("workerId:");
      sb.append(this.workerId);
      first = false;
      if (!first) {
        sb.append(", ");
      }
      sb.append("num:");
      sb.append(this.num);
      first = false;
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        issetBitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class NextIdsArgsStandardSchemeFactory implements SchemeFactory {
      public NextIdsArgsStandardScheme getScheme() {
        return new NextIdsArgsStandardScheme();
      }
    }

    private static class NextIdsArgsStandardScheme extends StandardScheme<NextIdsArgs> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, NextIdsArgs struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 1: // WORKER_ID
              if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                struct.workerId = iprot.readI64();
                struct.setWorkerIdIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            case 2: // NUM
              if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                struct.num = iprot.readI64();
                struct.setNumIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, NextIdsArgs struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldBegin(WORKER_ID_FIELD_DESC);
        oprot.writeI64(struct.workerId);
        oprot.writeFieldEnd();
        oprot.writeFieldBegin(NUM_FIELD_DESC);
        oprot.writeI64(struct.num);
        oprot.writeFieldEnd();
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class NextIdsArgsTupleSchemeFactory implements SchemeFactory {
      public NextIdsArgsTupleScheme getScheme() {
        return new NextIdsArgsTupleScheme();
      }
    }

    private static class NextIdsArgsTupleScheme extends TupleScheme<NextIdsArgs> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, NextIdsArgs struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetWorkerId()) {
          optionals.set(0);
        }
        if (struct.isSetNum()) {
          optionals.set(1);
        }
        oprot.writeBitSet(optionals, 2);
        if (struct.isSetWorkerId()) {
          oprot.writeI64(struct.workerId);
        }
        if (struct.isSetNum()) {
          oprot.writeI64(struct.num);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, NextIdsArgs struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(2);
        if (incoming.get(0)) {
          struct.workerId = iprot.readI64();
          struct.setWorkerIdIsSet(true);
        }
        if (incoming.get(1)) {
          struct.num = iprot.readI64();
          struct.setNumIsSet(true);
        }
      }
    }

  }

  public static class NextIdsResult implements
      org.apache.thrift.TBase<NextIdsResult, NextIdsResult.Fields>, java.io.Serializable,
      Cloneable, Comparable<NextIdsResult> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("nextIds_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT,
            (short) 0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new NextIdsResultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new NextIdsResultTupleSchemeFactory());
    }

    public IdsResult success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and.
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap.put(Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
          org.apache.thrift.TFieldRequirementType.DEFAULT,
          new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
              IdsResult.class)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NextIdsResult.class,
          metaDataMap);
    }

    public NextIdsResult() {}

    public NextIdsResult(IdsResult success) {
      this();
      this.success = success;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public NextIdsResult(NextIdsResult other) {
      if (other.isSetSuccess()) {
        this.success = new IdsResult(other.success);
      }
    }

    public NextIdsResult deepCopy() {
      return new NextIdsResult(this);
    }

    @Override
    public void clear() {
      this.success = null;
    }

    public IdsResult getSuccess() {
      return this.success;
    }

    public NextIdsResult setSuccess(IdsResult success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise. */
    public boolean isSetSuccess() {
      return this.success != null;
    }

    /**
     * 设置集合.
     */
    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((IdsResult) value);
          }
          break;
        default:
      }
    }

    /**
     * 设置字段值.
     */
    public Object getFieldValue(Fields field) {
      switch (field) {
        case SUCCESS:
          return getSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof NextIdsResult) {
        return this.equals((NextIdsResult) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(NextIdsResult that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentSuccess = true && this.isSetSuccess();
      boolean thatPresentSuccess = true && that.isSetSuccess();
      if (thisPresentSuccess || thatPresentSuccess) {
        if (!(thisPresentSuccess && thatPresentSuccess)) {
          return false;
        }
        if (!this.success.equals(that.success)) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentSuccess = true && (isSetSuccess());
      list.add(presentSuccess);
      if (presentSuccess) {
        list.add(success);
      }

      return list.hashCode();
    }

    @Override
    public int compareTo(NextIdsResult other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("nextIds_result(");

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      sb.append(")");
      return sb.toString();
    }

    /**
     * 验证.
     */
    public void validate() throws org.apache.thrift.TException {
      if (success != null) {
        success.validate();
      }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class NextIdsResultStandardSchemeFactory implements SchemeFactory {
      public NextIdsResultStandardScheme getScheme() {
        return new NextIdsResultStandardScheme();
      }
    }

    private static class NextIdsResultStandardScheme extends StandardScheme<NextIdsResult> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, NextIdsResult struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                struct.success = new IdsResult();
                struct.success.read(iprot);
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, NextIdsResult struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.success != null) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          struct.success.write(oprot);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class NextIdsResultTupleSchemeFactory implements SchemeFactory {
      public NextIdsResultTupleScheme getScheme() {
        return new NextIdsResultTupleScheme();
      }
    }

    private static class NextIdsResultTupleScheme extends TupleScheme<NextIdsResult> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, NextIdsResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          struct.success.write(oprot);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, NextIdsResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = new IdsResult();
          struct.success.read(iprot);
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

  public static class DatacenterIdArgs implements
      org.apache.thrift.TBase<DatacenterIdArgs, DatacenterIdArgs.Fields>, java.io.Serializable,
      Cloneable, Comparable<DatacenterIdArgs> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("datacenterId_args");


    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new DatacenterIdArgsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new DatacenterIdArgsTupleSchemeFactory());
    }


    /**
     * The set of fields this struct contains, along with convenience methods for finding and.
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      ;

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DatacenterIdArgs.class,
          metaDataMap);
    }

    public DatacenterIdArgs() {}

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public DatacenterIdArgs(DatacenterIdArgs other) {}

    public DatacenterIdArgs deepCopy() {
      return new DatacenterIdArgs(this);
    }

    @Override
    public void clear() {}

    public void setFieldValue(Fields field, Object value) {
    }

    /**
     * 设置字段值.
     */
    public Object getFieldValue(Fields field) {
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof DatacenterIdArgs) {
        return this.equals((DatacenterIdArgs) that);
      }
      return false;
    }

    /**
     * 比较.
     */
    public boolean equals(DatacenterIdArgs that) {
      if (that == null) {
        return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      return list.hashCode();
    }

    @Override
    public int compareTo(DatacenterIdArgs other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("datacenterId_args(");

      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class DatacenterIdArgsStandardSchemeFactory implements SchemeFactory {
      public DatacenterIdArgsStandardScheme getScheme() {
        return new DatacenterIdArgsStandardScheme();
      }
    }

    private static class DatacenterIdArgsStandardScheme extends StandardScheme<DatacenterIdArgs> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, DatacenterIdArgs struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, DatacenterIdArgs struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class DatacenterIdArgsTupleSchemeFactory implements SchemeFactory {
      public DatacenterIdArgsTupleScheme getScheme() {
        return new DatacenterIdArgsTupleScheme();
      }
    }

    private static class DatacenterIdArgsTupleScheme extends TupleScheme<DatacenterIdArgs> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, DatacenterIdArgs struct)
          throws org.apache.thrift.TException {
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, DatacenterIdArgs struct)
          throws org.apache.thrift.TException {
      }
    }

  }

  public static class DatacenterIdResult implements
      org.apache.thrift.TBase<DatacenterIdResult, DatacenterIdResult.Fields>,
      java.io.Serializable, Cloneable, Comparable<DatacenterIdResult> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("datacenterId_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64,
            (short) 0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new DatacenterIdResultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new DatacenterIdResultTupleSchemeFactory());
    }

    public long success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    private static final int __SUCCESS_ISSET_ID = 0;
    private byte issetBitfield = 0;
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap
          .put(Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DatacenterIdResult.class,
          metaDataMap);
    }

    public DatacenterIdResult() {}

    /**
     * id结果集.
     */
    public DatacenterIdResult(long success) {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public DatacenterIdResult(DatacenterIdResult other) {
      issetBitfield = other.issetBitfield;
      this.success = other.success;
    }

    public DatacenterIdResult deepCopy() {
      return new DatacenterIdResult(this);
    }

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
    }

    public long getSuccess() {
      return this.success;
    }

    /**
     * 设置成功.
     */
    public DatacenterIdResult setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise. */
    public boolean isSetSuccess() {
      return EncodingUtils.testBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __SUCCESS_ISSET_ID, value);
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((Long) value);
          }
          break;
        default:
      }
    }

    /**
     * 获取字段值.
     */
    public Object getFieldValue(Fields field) {
      switch (field) {
        case SUCCESS:
          return getSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof DatacenterIdResult) {
        return this.equals((DatacenterIdResult) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(DatacenterIdResult that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentSuccess = true;
      boolean thatPresentSuccess = true;
      if (thisPresentSuccess || thatPresentSuccess) {
        if (!(thisPresentSuccess && thatPresentSuccess)) {
          return false;
        }
        if (this.success != that.success) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentSuccess = true;
      list.add(presentSuccess);
      if (presentSuccess) {
        list.add(success);
      }
      return list.hashCode();
    }

    @Override
    public int compareTo(DatacenterIdResult other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("datacenterId_result(");
      sb.append("success:");
      sb.append(this.success);
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        issetBitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class DatacenterIdResultStandardSchemeFactory implements SchemeFactory {
      public DatacenterIdResultStandardScheme getScheme() {
        return new DatacenterIdResultStandardScheme();
      }
    }

    private static class DatacenterIdResultStandardScheme extends
        StandardScheme<DatacenterIdResult> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, DatacenterIdResult struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                struct.success = iprot.readI64();
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, DatacenterIdResult struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.isSetSuccess()) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeI64(struct.success);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class DatacenterIdResultTupleSchemeFactory implements SchemeFactory {
      public DatacenterIdResultTupleScheme getScheme() {
        return new DatacenterIdResultTupleScheme();
      }
    }

    private static class DatacenterIdResultTupleScheme extends TupleScheme<DatacenterIdResult> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, DatacenterIdResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          oprot.writeI64(struct.success);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, DatacenterIdResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = iprot.readI64();
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

  public static class TimestampArgs implements
      org.apache.thrift.TBase<TimestampArgs, TimestampArgs.Fields>, java.io.Serializable,
      Cloneable, Comparable<TimestampArgs> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("timestamp_args");


    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new TimestampArgsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new TimestampArgsTupleSchemeFactory());
    }


    /**
     * The set of fields this struct contains, along with convenience methods for finding and.
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      ;

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TimestampArgs.class,
          metaDataMap);
    }

    public TimestampArgs() {}

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public TimestampArgs(TimestampArgs other) {}

    public TimestampArgs deepCopy() {
      return new TimestampArgs(this);
    }

    @Override
    public void clear() {}

    public void setFieldValue(Fields field, Object value) {
    }

    /**
     * 获取值.
     */
    public Object getFieldValue(Fields field) {
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof TimestampArgs) {
        return this.equals((TimestampArgs) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(TimestampArgs that) {
      if (that == null) {
        return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      return list.hashCode();
    }

    @Override
    public int compareTo(TimestampArgs other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("timestamp_args(");
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
      // check for required fields
      // check for sub-struct validity
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class TimestampArgsStandardSchemeFactory implements SchemeFactory {
      public TimestampArgsStandardScheme getScheme() {
        return new TimestampArgsStandardScheme();
      }
    }

    private static class TimestampArgsStandardScheme extends StandardScheme<TimestampArgs> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, TimestampArgs struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, TimestampArgs struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class TimestampArgsTupleSchemeFactory implements SchemeFactory {
      public TimestampArgsTupleScheme getScheme() {
        return new TimestampArgsTupleScheme();
      }
    }

    private static class TimestampArgsTupleScheme extends TupleScheme<TimestampArgs> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, TimestampArgs struct)
          throws org.apache.thrift.TException {
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, TimestampArgs struct)
          throws org.apache.thrift.TException {
      }
    }

  }

  public static class TimestampResult implements
      org.apache.thrift.TBase<TimestampResult, TimestampResult.Fields>, java.io.Serializable,
      Cloneable, Comparable<TimestampResult> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("timestamp_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I64,
            (short) 0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new TimestampResultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new TimestampResultTupleSchemeFactory());
    }

    public long success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and.
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    private static final int __SUCCESS_ISSET_ID = 0;
    private byte issetBitfield = 0;
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap
          .put(Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I64)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TimestampResult.class,
          metaDataMap);
    }

    public TimestampResult() {}

    /**
     * 时间错结果集.
     */
    public TimestampResult(long success) {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public TimestampResult(TimestampResult other) {
      issetBitfield = other.issetBitfield;
      this.success = other.success;
    }

    public TimestampResult deepCopy() {
      return new TimestampResult(this);
    }

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
    }

    public long getSuccess() {
      return this.success;
    }

    /**
     * 设置成功.
     */
    public TimestampResult setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise. */
    public boolean isSetSuccess() {
      return EncodingUtils.testBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __SUCCESS_ISSET_ID, value);
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((Long) value);
          }
          break;
        default:
      }
    }

    /**
     * 获取字段值.
     */
    public Object getFieldValue(Fields field) {
      switch (field) {
        case SUCCESS:
          return getSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof TimestampResult) {
        return this.equals((TimestampResult) that);
      }
      return false;
    }

    /**
     * 比较大小.
     */
    public boolean equals(TimestampResult that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentSuccess = true;
      boolean thatPresentSuccess = true;
      if (thisPresentSuccess || thatPresentSuccess) {
        if (!(thisPresentSuccess && thatPresentSuccess)) {
          return false;
        }
        if (this.success != that.success) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentSuccess = true;
      list.add(presentSuccess);
      if (presentSuccess) {
        list.add(success);
      }

      return list.hashCode();
    }

    @Override
    public int compareTo(TimestampResult other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("timestamp_result(");

      sb.append("success:");
      sb.append(this.success);
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        issetBitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class TimestampResultStandardSchemeFactory implements SchemeFactory {
      public TimestampResultStandardScheme getScheme() {
        return new TimestampResultStandardScheme();
      }
    }

    private static class TimestampResultStandardScheme extends StandardScheme<TimestampResult> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, TimestampResult struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                struct.success = iprot.readI64();
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, TimestampResult struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.isSetSuccess()) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeI64(struct.success);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class TimestampResultTupleSchemeFactory implements SchemeFactory {
      public TimestampResultTupleScheme getScheme() {
        return new TimestampResultTupleScheme();
      }
    }

    private static class TimestampResultTupleScheme extends TupleScheme<TimestampResult> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, TimestampResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          oprot.writeI64(struct.success);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, TimestampResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = iprot.readI64();
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

  public static class PingArgs implements org.apache.thrift.TBase<PingArgs, PingArgs.Fields>,
      java.io.Serializable, Cloneable, Comparable<PingArgs> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("ping_args");


    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new PingArgsStandardSchemeFactory());
      schemes.put(TupleScheme.class, new PingArgsTupleSchemeFactory());
    }


    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      ;

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PingArgs.class, metaDataMap);
    }

    public PingArgs() {}

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public PingArgs(PingArgs other) {}

    public PingArgs deepCopy() {
      return new PingArgs(this);
    }

    @Override
    public void clear() {}

    public void setFieldValue(Fields field, Object value) {
    }

    /**
     * 获取值.
     */
    public Object getFieldValue(Fields field) {
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof PingArgs) {
        return this.equals((PingArgs) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(PingArgs that) {
      if (that == null) {
        return false;
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      return list.hashCode();
    }

    @Override
    public int compareTo(PingArgs other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("ping_args(");

      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class PingArgsStandardSchemeFactory implements SchemeFactory {
      public PingArgsStandardScheme getScheme() {
        return new PingArgsStandardScheme();
      }
    }

    private static class PingArgsStandardScheme extends StandardScheme<PingArgs> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, PingArgs struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        // check for required fields of primitive type, which can't be checked in the validate
        // method
        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, PingArgs struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class PingArgsTupleSchemeFactory implements SchemeFactory {
      public PingArgsTupleScheme getScheme() {
        return new PingArgsTupleScheme();
      }
    }

    private static class PingArgsTupleScheme extends TupleScheme<PingArgs> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, PingArgs struct)
          throws org.apache.thrift.TException {
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, PingArgs struct)
          throws org.apache.thrift.TException {
      }
    }

  }

  public static class PingResult implements
      org.apache.thrift.TBase<PingResult, PingResult.Fields>, java.io.Serializable, Cloneable,
      Comparable<PingResult> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
        new org.apache.thrift.protocol.TStruct("ping_result");

    private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC =
        new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.I32,
            (short) 0);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
        new HashMap<Class<? extends IScheme>, SchemeFactory>();
    
    static {
      schemes.put(StandardScheme.class, new PingResultStandardSchemeFactory());
      schemes.put(TupleScheme.class, new PingResultTupleSchemeFactory());
    }

    public int success; // required

    /**
     * The set of fields this struct contains, along with convenience methods for finding and
     * manipulating them.
     */
    public enum Fields implements org.apache.thrift.TFieldIdEnum {
      SUCCESS((short) 0, "success");

      private static final Map<String, Fields> byName = new HashMap<String, Fields>();

      static {
        for (Fields field : EnumSet.allOf(Fields.class)) {
          byName.put(field.getFieldName(), field);
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, or null if its not found.
       */
      public static Fields findByThriftId(int fieldId) {
        switch (fieldId) {
          case 0: // SUCCESS
            return SUCCESS;
          default:
            return null;
        }
      }

      /**
       * Find the _Fields constant that matches fieldId, throwing an exception if it is not found.
       */
      public static Fields findByThriftIdOrThrow(int fieldId) {
        Fields fields = findByThriftId(fieldId);
        if (fields == null) {
          throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
        }
        return fields;
      }

      /**
       * Find the _Fields constant that matches name, or null if its not found.
       */
      public static Fields findByName(String name) {
        return byName.get(name);
      }

      private final short thriftId;
      private final String fieldName;

      Fields(short id, String name) {
        thriftId = id;
        fieldName = name;
      }

      public short getThriftFieldId() {
        return thriftId;
      }

      public String getFieldName() {
        return fieldName;
      }
    }

    // isset id assignments
    private static final int __SUCCESS_ISSET_ID = 0;
    private byte issetBitfield = 0;
    public static final Map<Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    
    static {
      Map<Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
          new EnumMap<Fields, org.apache.thrift.meta_data.FieldMetaData>(Fields.class);
      tmpMap
          .put(Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success",
              org.apache.thrift.TFieldRequirementType.DEFAULT,
              new org.apache.thrift.meta_data.FieldValueMetaData(
                  org.apache.thrift.protocol.TType.I32)));
      metaDataMap = Collections.unmodifiableMap(tmpMap);
      org.apache.thrift.meta_data.FieldMetaData
          .addStructMetaDataMap(PingResult.class, metaDataMap);
    }

    public PingResult() {}

    /**
     * 获取拼结果集.
     */
    public PingResult(int success) {
      this();
      this.success = success;
      setSuccessIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public PingResult(PingResult other) {
      issetBitfield = other.issetBitfield;
      this.success = other.success;
    }

    public PingResult deepCopy() {
      return new PingResult(this);
    }

    @Override
    public void clear() {
      setSuccessIsSet(false);
      this.success = 0;
    }

    public int getSuccess() {
      return this.success;
    }

    /**
     * 处理成功信息.
     */
    public PingResult setSuccess(int success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      issetBitfield = EncodingUtils.clearBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    /** Returns true if field success is set (has been assigned a value) and false otherwise. */
    public boolean isSetSuccess() {
      return EncodingUtils.testBit(issetBitfield, __SUCCESS_ISSET_ID);
    }

    public void setSuccessIsSet(boolean value) {
      issetBitfield = EncodingUtils.setBit(issetBitfield, __SUCCESS_ISSET_ID, value);
    }

    /**
     * 设置字段值.
     */
    public void setFieldValue(Fields field, Object value) {
      switch (field) {
        case SUCCESS:
          if (value == null) {
            unsetSuccess();
          } else {
            setSuccess((Integer) value);
          }
          break;
        default:
      }
    }

    /**
     * 获取值.
     */
    public Object getFieldValue(Fields field) {
      
      switch (field) {
        case SUCCESS:
          return getSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    /**
     * Returns true if field corresponding to fieldID is set (has been assigned a value) and false.
     * otherwise
     */
    public boolean isSet(Fields field) {
      if (field == null) {
        throw new IllegalArgumentException();
      }

      switch (field) {
        case SUCCESS:
          return isSetSuccess();
        default:
      }
      throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
      if (that == null) {
        return false;
      }
      if (that instanceof PingResult) {
        return this.equals((PingResult) that);
      }
      return false;
    }

    /**
     * 比较值.
     */
    public boolean equals(PingResult that) {
      if (that == null) {
        return false;
      }

      boolean thisPresentSuccess = true;
      boolean thatPresentSuccess = true;
      if (thisPresentSuccess || thatPresentSuccess) {
        if (!(thisPresentSuccess && thatPresentSuccess)) {
          return false;
        }
        if (this.success != that.success) {
          return false;
        }
      }

      return true;
    }

    @Override
    public int hashCode() {
      List<Object> list = new ArrayList<Object>();

      boolean presentSuccess = true;
      list.add(presentSuccess);
      if (presentSuccess) {
        list.add(success);
      }

      return list.hashCode();
    }

    @Override
    public int compareTo(PingResult other) {
      if (!getClass().equals(other.getClass())) {
        return getClass().getName().compareTo(other.getClass().getName());
      }

      int lastComparison = 0;

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      if (isSetSuccess()) {
        lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
        if (lastComparison != 0) {
          return lastComparison;
        }
      }
      return 0;
    }

    public Fields fieldForId(int fieldId) {
      return Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot)
        throws org.apache.thrift.TException {
      schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot)
        throws org.apache.thrift.TException {
      schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
      StringBuilder sb = new StringBuilder("ping_result(");

      sb.append("success:");
      sb.append(this.success);
      sb.append(")");
      return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
      try {
        write(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(out)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException,
        ClassNotFoundException {
      try {
        // it doesn't seem like you should have to do this, but java serialization is wacky, and
        // doesn't call the default constructor.
        issetBitfield = 0;
        read(new org.apache.thrift.protocol.TCompactProtocol(
            new org.apache.thrift.transport.TIOStreamTransport(in)));
      } catch (org.apache.thrift.TException te) {
        throw new java.io.IOException(te);
      }
    }

    private static class PingResultStandardSchemeFactory implements SchemeFactory {
      public PingResultStandardScheme getScheme() {
        return new PingResultStandardScheme();
      }
    }

    private static class PingResultStandardScheme extends StandardScheme<PingResult> {

      public void read(org.apache.thrift.protocol.TProtocol iprot, PingResult struct)
          throws org.apache.thrift.TException {
        org.apache.thrift.protocol.TField schemeField;
        iprot.readStructBegin();
        while (true) {
          schemeField = iprot.readFieldBegin();
          if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
            break;
          }
          switch (schemeField.id) {
            case 0: // SUCCESS
              if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                struct.success = iprot.readI32();
                struct.setSuccessIsSet(true);
              } else {
                org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
              }
              break;
            default:
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
          }
          iprot.readFieldEnd();
        }
        iprot.readStructEnd();

        struct.validate();
      }

      public void write(org.apache.thrift.protocol.TProtocol oprot, PingResult struct)
          throws org.apache.thrift.TException {
        struct.validate();

        oprot.writeStructBegin(STRUCT_DESC);
        if (struct.isSetSuccess()) {
          oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
          oprot.writeI32(struct.success);
          oprot.writeFieldEnd();
        }
        oprot.writeFieldStop();
        oprot.writeStructEnd();
      }

    }

    private static class PingResultTupleSchemeFactory implements SchemeFactory {
      public PingResultTupleScheme getScheme() {
        return new PingResultTupleScheme();
      }
    }

    private static class PingResultTupleScheme extends TupleScheme<PingResult> {

      @Override
      public void write(org.apache.thrift.protocol.TProtocol prot, PingResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol oprot = (TTupleProtocol) prot;
        BitSet optionals = new BitSet();
        if (struct.isSetSuccess()) {
          optionals.set(0);
        }
        oprot.writeBitSet(optionals, 1);
        if (struct.isSetSuccess()) {
          oprot.writeI32(struct.success);
        }
      }

      @Override
      public void read(org.apache.thrift.protocol.TProtocol prot, PingResult struct)
          throws org.apache.thrift.TException {
        TTupleProtocol iprot = (TTupleProtocol) prot;
        BitSet incoming = iprot.readBitSet(1);
        if (incoming.get(0)) {
          struct.success = iprot.readI32();
          struct.setSuccessIsSet(true);
        }
      }
    }

  }

}
